<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('admin_name', 30)->default('')->comment('管理员用户名');
            $table->char('admin_pass', 60)->default('')->comment('管理员密码');
            $table->string('admin_nickname', 30)->default('')->comment('管理员昵称');
            $table->string('admin_avartar', 150)->default('')->comment('管理员头像');
            $table->string('admin_email', 50)->default('')->comment('管理员邮箱');
            $table->dateTime('admin_createtime')->comment('管理员创建时间');
            $table->dateTime('admin_logintime')->nullable()->comment('最后登录时间');
            $table->char('admin_loginip', 16)->nullable()->comment('最后登录ip');
            $table->tinyInteger('admin_status')->default(1)->comment('管理员状态');
            $table->index(['admin_name', 'admin_email']);
            $table->index('admin_status');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('admin_user');
    }
}
